package com.jf.springboot.web;

import com.jf.springboot.bean.Furniture;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:22954
 * Date:2024-12-06
 * Time:17:33
 */
@RestController
public class DruidController {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @GetMapping("/listFurn")
    public List<Furniture> listFurn() {
        List<Furniture> furnitureList = jdbcTemplate.query("select * from furniture", new BeanPropertyRowMapper<>(Furniture.class));
        return furnitureList;
    }
}
